<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use App\Http\Controllers\Controller;
use App\Models\Coupon;
use App\Models\CouponUsers;
use Illuminate\Http\Request;

class CouponController extends BaseController
{
    /**
     * 我的优惠券
     * @return \Illuminate\Http\JsonResponse
     */
    public function getCoupon()
    {
        $data=CouponUsers::with('coupon')->where('users_id',\request()->userId)->paginate(\request()->input('limit',10));
        return $this->success($data);
    }

    public function couponAll()
    {
        return $this->success(Coupon::where('status',1)->orderBy('id','desc')->paginate(\request()->input('limit',10)));
    }
}
